package com.ocm.tourism.core.domain;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.TableGenerator;
import javax.persistence.Version;
import javax.validation.constraints.Size;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Configurable;

@Entity
@Configurable
public class ScheduleTour {

   @OneToOne(cascade=CascadeType.ALL)
   private FileInfo avatar;

   @OneToOne
   Business business;

   @NotEmpty
   private String title;

   @NotEmpty
   private String time;

   @NotEmpty
   private String price;

   private String arrivalTime;

   @Size(max = 4000)
   private String description;

   @OneToOne
   private CommonItems transport;

   private Date latestDate;

   @Enumerated(EnumType.STRING)
   private TourType tourType;

   @OneToOne(mappedBy="scheduleTour", cascade=CascadeType.ALL)
   private SaleOff saleOff; 

   @Lob
   @org.hibernate.annotations.Type(type = "org.hibernate.type.TextType")
   private String content;

   public String toString() {
      return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
   }

   @Id
   @GeneratedValue(strategy=GenerationType.TABLE,generator="GEN_SCHEDULETOUR")
   @TableGenerator(name = "GEN_SCHEDULETOUR", table = "SEQUENCE_LIST", allocationSize = 1, initialValue = 1, pkColumnName = "NAME", valueColumnName = "NEXT_SEQUENCE", pkColumnValue = "SCHEDULETOUR")
   private Long id;

   @Version
   @Column(name = "version")
   private Integer version;

   public Long getId() {
      return this.id;
   }

   public void setId(Long id) {
      this.id = id;
   }

   public Integer getVersion() {
      return this.version;
   }

   public void setVersion(Integer version) {
      this.version = version;
   }

   public Business getBusiness() {
      return business;
   }

   public void setBusiness(Business business) {
      this.business = business;
   }

   public String getTitle() {
      return title;
   }

   public void setTitle(String title) {
      this.title = title;
   }

   public String getTime() {
      return time;
   }

   public void setTime(String time) {
      this.time = time;
   }

   public String getPrice() {
      return price;
   }

   public void setPrice(String price) {
      this.price = price;
   }

   public String getArrivalTime() {
      return arrivalTime;
   }

   public void setArrivalTime(String arrivalTime) {
      this.arrivalTime = arrivalTime;
   }

   public CommonItems getTransport() {
      return transport;
   }

   public void setTransport(CommonItems transport) {
      this.transport = transport;
   }

   public Date getLatestDate() {
      return latestDate;
   }

   public void setLatestDate(Date latestDate) {
      this.latestDate = latestDate;
   }

   public String getContent() {
      return content;
   }

   public void setContent(String content) {
      this.content = content;
   }

   public FileInfo getAvatar() {
      return avatar;
   }

   public void setAvatar(FileInfo avatar) {
      this.avatar = avatar;
   }

   public TourType getTourType() {
      return tourType;
   }

   public void setTourType(TourType tourType) {
      this.tourType = tourType;
   }

   public String getDescription() {
      return description;
   }

   public void setDescription(String description) {
      this.description = description;
   }

   public SaleOff getSaleOff() {
      return saleOff;
   }

   public void setSaleOff(SaleOff saleOff) {
      this.saleOff = saleOff;
   }
}
